package com.medical.admin.cost.controller;

import com.medical.admin.cost.common.dto.TreatmentInfo;
import com.medical.admin.cost.service.TreatmentService;
import com.qf.medical.response.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

/**
 * 1.查询就诊信息
 * 2.增加就诊信息
 * 3.修改就诊信息
 * 4.删除就诊信息
 */
@Api(tags = "后台就诊信息管理接口API在线文档")
@RestController
@RequestMapping("treatment")
public class TreatmentController {
    @Resource
    private TreatmentService treatmentService;

    @ApiOperation("查询就诊信息详情")
    @GetMapping("/research/{indentId}")
    @ApiImplicitParam(name = "indentId",value = "订单id")
    public ResponseEntity<TreatmentInfo> researchByIndentId(@NotNull @PathVariable("indentId") Long indentId) {
        return ResponseEntity.success(treatmentService.researchByIndentId(indentId));
    }

    @ApiOperation("添加就诊信息详情")
    @PostMapping("/add")
    @ApiImplicitParam(name = "treatmentInfo",value = "就诊信息Dto实体类")
    public ResponseEntity<Integer> addTreatment(@NotNull @RequestBody TreatmentInfo treatmentInfo) {
        return ResponseEntity.success(treatmentService.addTreatment(treatmentInfo));
    }

    @ApiOperation("修改就诊信息详情")
    @PutMapping("/modify")
    @ApiImplicitParam(name = "treatmentInfo",value = "就诊信息Dto实体类")
    public ResponseEntity<Integer> modifyTreatment(@NotNull  @RequestBody TreatmentInfo treatmentInfo) {
        return ResponseEntity.success(treatmentService.modifyTreatment(treatmentInfo));
    }

    @ApiOperation("删除就诊信息详情")
    @DeleteMapping("/remove/{indentId}")
    @ApiImplicitParam(name = "indentId",value = "订单id")
    public ResponseEntity<Integer> removeTreatment(@NotNull @PathVariable("indentId") Long indentId) {
        return ResponseEntity.success(treatmentService.removeTreatment(indentId));
    }

}
